<?php
namespace plugin\ky_black\app\admin\model;

use support\Model;

class BlackCardSubBalanceLog extends Model
{
    protected $table = 'black_card_sub_balance_log';
    protected $primaryKey = 'log_id';
    
    protected $fillable = [
        'parent_card_id',
        'parent_card_no',
        'sub_card_id',
        'sub_card_no',
        'amount',
        'before_balance',
        'after_balance',
        'remark',
        'operator_id',
        'operator_name'
    ];

    /**
     * 关联主卡
     */
    public function parentCard()
    {
        return $this->belongsTo(BlackCard::class, 'parent_card_id', 'card_id');
    }

    /**
     * 关联子卡
     */
    public function subCard()
    {
        return $this->belongsTo(BlackCardSub::class, 'sub_card_id', 'sub_card_id');
    }
} 